{template 'common/header'}
<div class="main">
    <ul class="nav nav-tabs">
        <li {if $_GPC['do'] == 'votelist'}class="active"{/if}><a href="{php echo $this->createWebUrl('votelist');}">投票列表</a></li>
    </ul>
    <form action="" class="form-horizontal form" method="post" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$vote['id']}">
        <h4>投票活动</h4>
        <table class="tb">
            <tr>
                <th>活动名称</th>
                <td>{$vote['title']}</td>
            </tr>
        </table>
        <h4 class="alert-heading">投票选项编辑</h4>
        <table class="tb">
            <tr>
                <th></th>
                <td>
                    <div id="append-list" class="list">
                        {if !empty($options)}
                        {php $option_index = 1;}
                        {loop $options $item}
                        <div class="item" id="option-item-{$item['id']}">
                            <!--序号 :{$item['id']}-->
                            {php include $this->template('optionitem');}
                        </div>
                        {php $option_index++;}
                        {/loop}
                        {/if}
                    </div>
                    <script id="option-item-html" type="text/html">
                        {php unset($item); include $this->template('optionitem');}
                    </script>
                    <div class="reply-news-edit-button alert">
                        <a href="javascript:void(0);" onclick="Handler.buildAddForm('option-item-html', $('#append-list'))" class="btn">
                            <i class="icon-plus"></i> 添加选项
                        </a>
                    </div>
                </td>
            </tr>
        </table>

        <table class="tb">
            <tr>
                <th></th>
                <td>
                    <button type="submit" class="btn btn-primary span4" name="submit" value="提交">提交</button>
                    <input type="hidden" name="token" value="{$_W['token']}"/>
                </td>
            </tr>

        </table>

    </form>
</div>

<script type="text/javascript">
    <!--
    var Handler = {
        'buildAddForm' : function(id, targetwrap) {
            var obj = buildAddForm(id, targetwrap);
            //obj.html(obj.html().replace(/\(wrapitemid\)/gm, obj.attr('id')));
            //obj.html(obj.html().replace(/\(itemid\)/gm, obj.attr('id')));
        }
    };
    //-->
</script>
{template 'common/footer'}